package com.cn.xiaonuo.slbfinances.slbmarket.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.slbfinances.slbmarket.service.ISlbMarketService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@CrossOrigin
@RestController
public class SlbMarketController {

    @Resource
    private ISlbMarketService slbMarketService;

    @ApiOperation(value = "财务管理-出账-匀贸消费分润-列表", notes = "财务管理-出账-匀贸消费分润-列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "buySuperiorId", value = "上级ID", example = "10086"),
            @ApiImplicitParam(name = "buySuperiorName", value = "真实姓名", example = "张三"),
            @ApiImplicitParam(name = "buySuperiorPhone", value = "电话号码", example = "13800138000"),
            @ApiImplicitParam(name = "paymentState", value = "支付状态", example = "1"),
            @ApiImplicitParam(name = "buyUserId", value = "买家ID", example = "188888"),
            @ApiImplicitParam(name = "royaltyCondition", value = "确认状态", example = "5"),
            @ApiImplicitParam(name = "confirmBeginTime", value = "确认开始时间（Long）", example = "102565455"),
            @ApiImplicitParam(name = "confirmEndTime", value = "确认结束时间（Long）", example = "102565455"),
            @ApiImplicitParam(name = "orderId", value = "订单ID", example = "10086"),
            @ApiImplicitParam(name = "pageNo", value = "第几页（Integer）", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页长度（Integer）", required = true)
    })
    @RequestMapping(value = "api/slbmaket/buySuperiorPaymentList", method = RequestMethod.POST)
    public BusinessMessage buySuperiorPaymentList(String buySuperiorId, String buySuperiorName,
                                                  String buySuperiorPhone, String paymentState, String confirmBeginTime, String confirmEndTime,
                                                  String orderId, Integer pageNo, Integer pageSize, String buyUserId, String royaltyCondition) {

        return slbMarketService.buySuperiorPaymentList(buySuperiorId, buySuperiorName, buySuperiorPhone, paymentState, confirmBeginTime, confirmEndTime, orderId, pageNo, pageSize, buyUserId, royaltyCondition);
    }

    //03.订单购买者上级提成--财务结款
    @ApiOperation(value = "财务管理-出账-订单购买者上级提成--财务结款", notes = "财务管理-出账-订单购买者上级提成--财务结款")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginUserId", value = "登录用户ID", example = "10086"),
            @ApiImplicitParam(name = "buyRoyaltyId", value = "购买者ID", example = "20086"),
            @ApiImplicitParam(name = "paymentMoney", value = "支付金额", example = "88.88", required = true)
    })
    @RequestMapping(value = "api/slbmaket/buySuperiorPayment", method = RequestMethod.POST)
    public BusinessMessage buySuperiorPayment(String loginUserId, String buyRoyaltyId, String paymentMoney) {
        return slbMarketService.buySuperiorPayment(loginUserId, buyRoyaltyId, paymentMoney);
    }
    //03.订单购买者上级提成--财务结款--批量操作 192.168.1.3:8080/sl/api/common/v1/ymMarket/buySuperiorPaymentAll?buyRoyaltyIdList=[7,13,19]
    @ApiOperation(value = "财务管理-出账-.订单购买者上级提成--财务结款--批量操作", notes = "财务管理-出账-.订单购买者上级提成--财务结款--批量操作")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "paymentMoney", value = "支付金额", example = "[10086,12568]", required = true)
    })
    @RequestMapping(value = "api/slbmaket/buySuperiorPaymentAll", method = RequestMethod.POST)
    public BusinessMessage buySuperiorPaymentAll(String buyRoyaltyIdList){
        return slbMarketService.buySuperiorPaymentAll(buyRoyaltyIdList);
    }
}
